<template>
	<view>
		<view class="mui-content" id="address_view" style="margin: 6rpx 0 0rpx 0;">
		    <view id="noAddress" v-if="!isAddress">
		        <image style="width: 200px;height: 200px;" src="../../static/center/fenxiao_none.png" />
		        <p  style="font-size: 30px; ">暂无自提地址</p>
		    </view>
			<view class="address" v-if="isAddress">
			    <view class="box-a-1">
					<span id="name">{{zitiAddress.zitiName}}</span>
					<span id="phone">{{zitiAddress.phone}}</span>
				</view>
			    <p style="padding: 0px 10px;color: #BAAFAF;">{{zitiAddress.zitiDetail}}</p>
				<view class="box-a-2-right" @click="editAddress()">
					<image src="../../static/center/tousu.png" style="height: 20px;width: 20px;"/>
					<span>编辑</span>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				zitiAddress:{},		//自提地址
				isAddress:true,	//是否有自提地址
			}
		},
		onLoad() {
			this.getMyZitiAddress()
		},
		methods: {
			//得到我的自提地址
			getMyZitiAddress(){
				this.$http.get('/ppZitidian/getUserAllZitidian',{
					userId:uni.getStorageSync('usersId')
				}).then(res => {
					if(res.data.code==200){
						this.zitiAddress = res.data.data;
						this.isAddress = true;
					}else{
						// this.$u.toast("还没有自提地址");
						this.isAddress = false;
					}
				})
			},
			//编辑自提地址
			editAddress(){
				console.log("点击编辑地址了");
				console.log(this.zitiAddress)
				uni.navigateTo({
					url:'addZitiAddress?ppid='+this.zitiAddress.ppId+'&zitiDetail='+this.zitiAddress.zitiDetail+'&name='+this.zitiAddress.name+'&zitiName='+this.zitiAddress.zitiName+'&phone='+this.zitiAddress.phone+'&password='+this.zitiAddress.password+'&adId='+this.zitiAddress.zitiId
				})
			}
		}
	}
</script>

<style>
	.address{
		background-color: white;
	}
    .box-a-2-left input {
        background-color: #000000;
    }
    .box-a-2-left .choose {
        height: 10px;
        width: 10px;
    }
    .box-a-2-left .bottom {
        float: left;
        height: 20px;
        width: 20px;
        margin:12px 8px 12px 10px;
    }
    .box-a-2-right{
        color: #000000;
		text-align: center;
        height:40px;
		line-height: 40px;
    }
    .box-a-2-right image{
        vertical-align:text-bottom;
        margin:0 6px 0 9px;
    }
    #noAddress{
        text-align: center;
        margin-top: 130px;
    }
	.box-a-1 {
		font-size: 16px;
		line-height: 45px;
		padding: 3px 10px;
	}
	.box-a-1 #phone {
		float: right;
	}
	.box-a p {
		font-size: 14px;
		line-height: 20px;
		padding:0 10px;
		padding-bottom:3px;
	}
	.nav-header h1 {
		text-align: left;
	}
	.nav-header a {
		color: white;
	}
</style>
